package com.example.ffepeg.ffpeg;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;

@Slf4j
public class ListValueDelet {
    public static void main(String[] args) {
/*
        List<Integer> list = Arrays.asList(1,2,3);
        Map<String,Object> map = new HashMap<>();
        map.put("1",258741);
        map.put("3",888741);
        map.put("5",999741);
        map.forEach((keyId,value) ->{
           if (list.contains(Integer.parseInt(keyId))){
               System.out.println("map中的key是: " + keyId  + "  map中的value是: "+ value);
           }
        });
        */


    }


    private static String createFileName(String name){
        String uuid = UUID.randomUUID().toString().replaceAll("-","");
        return uuid + name;
    }


    public static void deleteFilesFromList(List<String> filePathStrings) {
        for (String filePathString : filePathStrings) {
            Path path = Paths.get(filePathString);
            try {
                if (Files.exists(path) && Files.isRegularFile(path)) {
                    Files.delete(path);
                    log.info("文件删除成功: " + path);
                } else {
                    log.error("文件不存在或不是常规文件: " + path);
                }
            } catch (IOException e) {
                log.error("文件删除失败: " + path);
            }
        }
    }
}
